<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>基于 layui 的界面设计</title>
    <!-- 引入 layui 的 CSS 文件，注意在正式项目中请替换为正确的路径 -->
    <link rel="stylesheet" href="//unpkg.com/layui@2.9.21/dist/css/layui.css">
    <style>
        body {
            background-color: #f9f9f9;
            font-family: Arial, sans-serif;
        }

       .layui-nav {
            height: 60px;
            background-color: #333;
            display: flex;
            align-items: center;
        }

       .layui-nav-left {
            flex: 1;
        }

       .layui-nav-center {
            flex: 2;
            display: flex;
            justify-content: center;
        }

       .layui-nav-right {
            flex: 1;
            display: flex;
            justify-content: flex-end;
        }

       .layui-nav-item a {
            color: #fff;
            padding: 0 20px;
        }

       .layui-nav-item.layui-this {
            background-color: #009688;
        }

       .layui-nav-child {
            background-color: #444;
        }

       .layui-nav-child dd a {
            color: #fff;
        }

       .content {
            padding: 20px;
            background-color: #fff;
            min-height: 500px;
        }
    </style>
</head>

<body>
<!-- 导航栏 -->
<ul class="layui-nav" lay-filter="demo-filter-nav">
    <div class="layui-nav-left">
        <li class="layui-nav-item"><a href="javascript:void(0);" data-url="home.html">首页</a></li>
    </div>
    <div class="layui-nav-center">
        <li class="layui-nav-item layui-this"><a href="javascript:void(0);" data-url="knowledge_base.html">知识库</a></li>
        <li class="layui-nav-item"><a href="javascript:void(0);" data-url="chat.html">聊天</a></li>
        <li class="layui-nav-item"><a href="javascript:void(0);" data-url="search.html">搜索</a></li>
        <li class="layui-nav-item"><a href="javascript:void(0);" data-url="model_management.html">模型管理</a></li>
        <li class="layui-nav-item"><a href="javascript:void(0);" data-url="vector_management.html">向量管理</a></li>
    </div>
    <div class="layui-nav-right">
        <li class="layui-nav-item"><a href="javascript:void(0);" data-url="end_page.html">设置</a></li>
    </div>
</ul>
<!-- 内容区域 -->
<div class="content">
    <!-- 这里可以根据不同的 tab 内容进行填充 -->
</div>
<!-- 引入 layui 的 JS 文件，注意在正式项目中请替换为正确的路径 -->
<script src="//unpkg.com/layui@2.9.21/dist/layui.js"></script>
<script>
    layui.use(['element', 'jquery'], function () {
        var element = layui.element;
        var $ = layui.jquery;

        // 监听导航栏点击事件
        $('.layui-nav-item a').click(function () {
            var url = $(this).data('url');
            if (url) {
                $.ajax({
                    url: url,
                    method: 'GET',
                    success: function (data) {
                        $('.content').html(data);
                    },
                    error: function () {
                        $('.content').html('<h2>加载失败</h2><p>无法加载该页面内容，请稍后重试。</p>');
                    }
                });
            }
        });

        // 初始加载知识库页面内容
        $.ajax({
            url: 'knowledge_base.html',
            method: 'GET',
            success: function (data) {
                $('.content').html(data);
            },
            error: function () {
                $('.content').html('<h2>加载失败</h2><p>无法加载该页面内容，请稍后重试。</p>');
            }
        });
    });
</script>
</body>

</html>